$(document).ajaxSend(function(event,xhr){
		xhr.setRequestHeader("token",localStorage.getItem("token"));
		xhr.setRequestHeader("x-requested-with","XMLHttpRequest")
	})
$.get(showCartApi,(res)=>{
	console.log(res.code)
	if(res.code == 1){
		location.href="denglu.html"
	}else{
		console.log(res.info)
		let productsArr = res.info
		let html =''
		let sum =0;
		for(let i=0;i<productsArr.length;i++){
			console.log(productsArr[i])
			let psum = `${productsArr[i].goodsNum}`*`${productsArr[i].goodsType.price}`
			html+= `
				<div class="item">
					<div class="img">
						<img src="img/js_b1.png">
					</div>
					<dl>
						<dt>${productsArr[i].goodsType.goods.goodsMsg}</dt>
						<dd>颜色：<span>${productsArr[i].goodsType.color.colorName}</span>  尺码：<span>${productsArr[i].goodsType.size.sizeName}</span></dd>
						<dd>数量:${productsArr[i].goodsNum}</dd>
						<dd>单价：¥ <span>${productsArr[i].goodsType.price}</span></dd>
						<dd>小计：¥ <span>${psum}</span></dd>
					</dl>
				</div>
			`
			sum += psum
		}
		$('.sec-top')[0].innerHTML = html
		$('.sumNum')[0].innerHTML = `¥${sum}`
	}
	
	$('.paid')[0].onclick=function(){
		alert('下单成功')
		location.href='index-jxAll.html'
	}
})